package com.ncmmall.domain.business.message;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ncmmall.domain.security.user.WebUser;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.sql.Timestamp;

/**
 * 消息
 *
 * @author likaikai
 * @date 2019-07-13 14:03
 */
@Entity
@Table(name = "mall_message")
@Access(AccessType.FIELD)
@Getter
@Setter
public class Message {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * 标题
     */
    private String title;

    /**
     * 摘要
     */
    private String digest;

    /**
     * 内容
     */
    @Lob
    private String content;

    /**
     * 1、系统消息
     * 2、订单通知
     */
    private int type;

    /**
     * 订单id,订单通知有效
     */
    private long orderId;

    /**
     * 退款id
     */
    private long orderAfterSaleId;

    /**
     * 提现记录id
     */
    private long withdrawRecordId;

    /**
     * 会员，订单通知,提现通知有效
     */
    @OneToOne
    private WebUser member;

    /**
     * 发送状态,系统消息有效
     * 1、未发送
     * 2、已发送
     */
    private int status;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Timestamp createTime;

    /**
     * 发送时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    private Timestamp sendTime;

    /**
     * 0、用户商城端
     * 1、商家采购端
     */
    private int platformType;

}
